package com.shigen.demo.service.impl;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author shigenfu
 * @date 2024/3/7 15:45
 */
@Service("testService")
@Slf4j
public class TestServiceImpl {

    /**
     * 不能和调用方放在同一个类中
     * <a href="https://blog.csdn.net/weixin_45151960/article/details/133988933">参考文章</a>
     */
    @SneakyThrows
    @Async("asyncExecutor")
    public void downloadFile() {
        log.info("开始-------");
        Thread.sleep(10*1000);
        log.info("结束-------");
    }

}
